<template>
  <div class="common-layout">
    <el-container>
      <el-aside width="200px" style="    height: 726px;
    background: white;">
        <el-radio-group style="
    height: 60px;
    background-color: white;
  " v-model="isCollapse" @change="handleCollapseChange">
          <el-radio-button :label="false">打开</el-radio-button>
          <el-radio-button :label="true">关闭</el-radio-button>
        </el-radio-group>
        <el-menu default-active="2" class="el-menu-vertical-demo" :collapse="isCollapse" @open="handleOpen"
          @close="handleClose" :router="true">
          <el-sub-menu index="1">
            <template #title>
              <el-icon>
                <FolderOpened />
              </el-icon>
              <span>信息管理</span>
            </template>
            <el-menu-item index="/EmployeeUser"><el-icon>
                <UserFilled />
              </el-icon>员工信息</el-menu-item>
            <el-menu-item index="/EmployeeRole"><el-icon>
                <Avatar />
              </el-icon>角色信息</el-menu-item>
            <el-menu-item index="3-1"><el-icon>
                <Stamp />
              </el-icon>我的信息</el-menu-item>
          </el-sub-menu>
          <el-sub-menu index="2">
            <template #title>
              <el-icon>
                <ShoppingTrolley />
              </el-icon>
              <span>订单管理</span>
            </template>
            <el-menu-item index="/DrinkInfo"><el-icon>
                <GobletSquareFull />
              </el-icon>酒水信息</el-menu-item>
            <el-menu-item index="/Liquorstock"><el-icon>
                <List />
              </el-icon>酒水库存</el-menu-item>
          </el-sub-menu>
          <el-sub-menu index="3">
            <template #title>
              <el-icon>
                <Shop />
              </el-icon>
              <span>酒吧商城</span>
            </template>
            <el-menu-item index="/"><el-icon></el-icon>商品信息</el-menu-item>
          </el-sub-menu>
        </el-menu>
      </el-aside>

      <el-container>
        <el-header style="background-color: azure; display: flex; justify-content: flex-end; align-items: center;">
          <div class="block" style="margin-right: 5px;">
            <el-avatar @click="drawer = true" :size="30" :src="circleUrl" />
          </div>
        </el-header>
        <el-main><router-view /></el-main>
        <el-footer style="background-color: azure;">Footer</el-footer>
      </el-container>
    </el-container>
    <el-drawer v-model="drawer" title="I am the title" :with-header="false">
      <span>这是抽屉</span>
    </el-drawer>
  </div>
</template>

<script setup>
import { ref, reactive, toRefs } from 'vue'
import { useRouter } from 'vue-router'
import { Document, Menu as IconMenu, FolderOpened, ShoppingTrolley, UserFilled, Avatar, GobletSquareFull, Stamp, Shop, List } from '@element-plus/icons-vue'

const state = reactive({
  circleUrl: 'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png',
})

const showDepartment = ref(true)
const isCollapse = ref(false)
const router = useRouter()

const handleOpen = (key, keyPath) => {
  console.log(key, keyPath)
}

const toggleDepartment = () => {
  showDepartment.value = !showDepartment.value
}

const handleClose = (key, keyPath) => {
  console.log(key, keyPath)
}

const handleCollapseChange = (value) => {
  isCollapse.value = value
}

const { circleUrl } = toRefs(state)

const drawer = ref(false)
</script>


<style>
.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 200px;
  min-height: 665px;
}
</style>